﻿<%@ WebHandler Language="C#" Class="DataBase" %>

using System;
using System.Web;
using OneShoppingBLL;
using OneShoppingModel;
using OneshoppingWeb;
using OneShoppingUtility;

public class DataBase : IHttpHandler {
    
    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/plain";

        //for (int i = 0; i < 20; i++)
        //{
        //    Activity activity = new Activity();

        //    activity.Total = 100;
        //    activity.Surplus = 100;
        //    activity.PlatformProfit = 10;
        //    activity.ApplyTime = Convert.ToDateTime("2016/12/15 14:04:59");
        //    DateTime start = Convert.ToDateTime("2016/12/15 22:10:59");
        //    DateTime end = Convert.ToDateTime("2016/12/21 14:04:59");
        //    activity.StartTime = start;
        //    activity.EndTime = end;
        //    activity.Url = "/Backstage/uploadImages/cdbefe4067b02897824e67b33ab48845.png";
        //    activity.SellerId = 1011;
        //    activity.Status = 0;

        //    activity.GoodsName = "2017新上架的商品"+i;
        //    activity.Introduce = "iphone 8 只要一块钱...";

        //    bool result = ActivityBLL.GetInstance().Insert(activity);

        //    if (!result)
        //    {
        //        context.Response.Write("Hello World!add fail"+i);
        //        return;
        //    }
            
        //}

        for (int i = 82547; i <= 300000; i++)
        {
            SystemUser suser = new SystemUser();
            suser.LoginName = "temptest" + i;
            suser.LoginPwd = "123";
            suser.RoleId = 3;
            suser.UserPhone = "13900000000";
            suser.Status = 1;
            bool res = SystemUserBLL.GetInstance().Insert(suser);
            if (res)
            {
                GeneralUser gUser = new GeneralUser();
                gUser.UserId = SystemUserBLL.GetInstance().GetEntity(r => r.LoginName == suser.LoginName).UserId;
                gUser.UserName = "测试账号..."+i;
                gUser.HeadImage = "uploadimages/de29770c-f3a1-4856-8b26-29cf0ac2f161.jpg";
                bool result = GeneralUserBLL.GetInstance().Insert(gUser);
                if (!result)
                {
                    context.Response.Write("Hello World!fail!general~~~~" + i);
                    return;
                }
            }
            else 
            {
                context.Response.Write("Hello World!fail!systemuser~~~~"+i);
                return;
            }
            
        }


        context.Response.Write("Hello World!success~~~~");
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}